package com.example.service;

import com.example.postprocessor.Fruit;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Fruit
@Service // 使用注解标记为Spring管理的Bean
@Slf4j
public class MessageServiceImpl implements MessageService {

    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    @Override
    public void addCityInfo(String name, String value) {
        redisTemplate.opsForValue().set( name, value);
    }

    @Override
    public String getMessage() {
        Object info = redisTemplate.opsForValue();
        return String.valueOf(info);
    }
}